#ifndef PROXY_H
#define PROXY_H

#include"real_subject.h"

#ifndef SAFE_DELETE
#define SAFE_DELETE(p) {if(p) {delete(p);(p)=nullptr;}}
#endif
class Proxy:public ITelco{

public:
    Proxy():m_pCMCC(nullptr){}
    ~Proxy(){SAFE_DELETE(m_pCMCC);}

    void Recharge(int money)override{
        if(money>=50){
            if(m_pCMCC==nullptr){
                m_pCMCC=new CMCC;
            }
            m_pCMCC->Recharge(money);
        }
        else{
            cout<<"Sorry,too title money.."<<endl;
        }

    }
private:
    CMCC *m_pCMCC;

};
#endif // PROXY_H
